import { AxiosPromise } from "axios"
import { Request } from '../request'


import { useUserInfo } from '/@/stores/userInfo';
const getToken = () => {
    return useUserInfo().getToken() || ''
}

//--------------------      home    ---------------------------
export const findHomeData = (): AxiosPromise<any> => {
    return Request.getReq(0)({
        url: '/admin/top/statistics/info',
        method: 'post',
        headers: {
            token: getToken()
        }
    })
}


//--------------------      顶部消息    ---------------------------
export const findMessageData = (): AxiosPromise<any> => {
    return Request.getReq(0)({
        url: '/admin/top/statistics/message',
        method: 'post',
        headers: {
            token: getToken()
        }
    })
}

//--------------------     消息已读    ---------------------------
export const readedMessage = (ids: string[], type: number): AxiosPromise<any> => {
    return Request.getReq(0)({
        url: '/admin/top/statistics/message/read',
        method: 'post',
        data: {
            ids: ids || [],
            type: type
        },
        headers: {
            token: getToken()
        }
    })
}